import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '创建人',
    align: 'center',
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: 'center',
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: 'center',
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: 'center',
    dataIndex: 'updateTime'
  },
  {
    title: '科室或楼层名称',
    align: 'left',
    dataIndex: 'name'
  },
  {
    title: '父级节点',
    align: 'center',
    dataIndex: 'pid'
  },
  {
    title: '医院ID',
    align: 'center',
    dataIndex: 'hospitalId',

  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "科室或楼层名称",
    field: "name",
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "医院ID",
    field: "hospitalId",
    component: 'Input',
    componentProps: { disabled: true },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '科室或楼层名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入科室或楼层名称!' },
      ];
    },
  },
  {
    label: '父级节点',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "nurse_dept,name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
  {
    label: '医院ID',
    field: 'hospitalId',
    component: 'Input',
    componentProps: { disabled: true },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  createBy: { title: '创建人', order: 0, view: 'text', type: 'string', },
  createTime: { title: '创建日期', order: 1, view: 'datetime', type: 'string', },
  updateBy: { title: '更新人', order: 2, view: 'text', type: 'string', },
  updateTime: { title: '更新日期', order: 3, view: 'datetime', type: 'string', },
  name: { title: '科室或楼层名称', order: 4, view: 'text', type: 'string', },
  pid: { title: '父级节点', order: 5, view: 'text', type: 'string', },
  hospitalId: { title: '医院ID', order: 6, view: 'text', type: 'string', },
};


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
